const {Router} = require('express');
const {handleLogin, handleLogout} = require('../Handler/router/login')
const handleGoods =require('../Handler/router/goods');
const {getSetting, setSetting} = require('../Handler/router/setting')
const {handleMulterConf, handleUpload} = require("../Handler/router/handleUpload");

const apiRouter = Router();

apiRouter.post('/login', handleLogin)
apiRouter.post('/logout', handleLogout)

apiRouter.get("/setting", getSetting)
apiRouter.post("/setting", setSetting)

let {getGoodsTypes, getGoodsByKeyWords, getGoodsByLimit, updateGoodsById, addGoods} = handleGoods

apiRouter.get('/goods/', getGoodsByLimit)
apiRouter.get('/goods/keywords/:keywords', getGoodsByKeyWords)
apiRouter.get('/goods/types', getGoodsTypes)
apiRouter.post('/goods/update', updateGoodsById)
apiRouter.post('/goods/add', addGoods)

apiRouter.post('/upload', handleMulterConf.single('image'), handleUpload)

module.exports = apiRouter;



